<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="t" uri="http://myfaces.apache.org/tomahawk"%>

<%@taglib prefix="a4j" uri="http://richfaces.org/a4j"%>
<%@taglib prefix="rich" uri="http://richfaces.org/rich"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<f:view>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <link type="text/css" rel="stylesheet" href="/finsys/style.css" media="screen"/>
            <title>Gesti&oacute;n de Creditos</title>
        </head>
        <body>
            <h1>Gesti&oacute;n de Creditos</h1>
            <h2>Validar Ingreso</h2>

            <a4j:outputPanel ajaxRendered="true">
                <h:form>
                    <fieldset>
                        <legend>Validar Ingreso</legend>
                        <h:panelGrid columns="1">
                            <h:panelGrid columns="2">
                                <h:outputLabel value="Tipo de Ingreso:" />
                                <h:selectOneMenu id="cboIngreso" value="#{ValidacionController.tipoIngreso}">
                                    <a4j:support event="onchange" reRender="TipoIngreso" />
                                    <f:selectItem itemLabel="Con Documento" itemValue="documento" />
                                    <f:selectItem itemLabel="Con Tarjeta" itemValue="tarjeta" />
                                </h:selectOneMenu>
                            </h:panelGrid>

                            <h:panelGroup id="TipoIngreso">
                                <h:panelGrid columns="2"  rendered="#{ValidacionController.tipoIngreso == 'documento'}">
                                    <h:outputLabel value="Tipo de Documento:" />
                                    <h:selectOneMenu id="cboTipoDocumento" value="#{ValidacionController.tipoDocumento}">
                                        <f:selectItem itemLabel="DNI" itemValue="dni" />
                                        <f:selectItem itemLabel="RUC" itemValue="ruc" />
                                        <f:selectItem itemLabel="Pasaporte" itemValue="pasaporte" />
                                    </h:selectOneMenu>
                                    
                                    <h:outputLabel value="Nro. Documento" for="txtDni"/>
                                    <h:inputText id="txtDni" styleClass="inputs"/>
                                </h:panelGrid>

                                <h:panelGrid columns="2" rendered="#{ValidacionController.tipoIngreso == 'tarjeta'}">
                                    <h:outputLabel value="Tarjeta" for="txtTarjeta" />
                                    <h:inputSecret id="txtTarjeta" styleClass="inputsRead" readonly="true"/>

                                    <h:outputLabel value="Clave" for="txtClave" />
                                    <h:inputSecret id="txtClave" styleClass="inputs" />
                                </h:panelGrid>
                            </h:panelGroup>

                            <h:panelGrid columns="2">
                                <h:panelGroup />
                                <h:panelGroup>
                                    <h:commandButton value="Validar" action="listar" />
                                    <h:commandButton value="Cancelar" action="volver" />
                                </h:panelGroup>
                            </h:panelGrid>

                        </h:panelGrid>
                    </fieldset>
                </h:form>
            </a4j:outputPanel>
        </body>
    </html>
</f:view>